<#assign pageTitle="我的下载记录"/>
<#assign pageHeader>
    <link rel="stylesheet" type="text/css" href="/static/h5/css/user.css?20220210"/>
    <style>
        .user-course-list{
            background-color: #ffffff;
        }
        hr{
            color: #c0c4cc;
            border-style:dotted;
        }
    </style>
</#assign>
<#assign pageContent>
    <van-nav-bar
            title="我的下载记录"
            left-text="返回"
            left-arrow
            @click-left="location.href='/user/index.html';"
            fixed
            placeholder
    ></van-nav-bar>
    <div class="main-item mt-12">
        <#if userDownloads?? && userDownloads?size gt 0>
            <div class="course-card">
                <#list userDownloads as item>
                    <van-row gutter="24">
                        <van-col span="24">
                            <div class="user-course-list">
                                <span class="fl">
                                    ${item.title!}</span>
                                <span class="fl">${item.createTime!}</span>
                                <van-button class="fr" type="primary" @click="toView(${item.typeId},${item.infoId})" size="small">查看</van-button>
                            </div>
                            <hr size=1>
                        </van-col>
                    </van-row>
                </#list>
            </div>
        <#else>
            <van-empty description="您还没有任何下载记录..."></van-empty>
            <div style="padding: 0 12px"  v-if="pageCount == 0"><van-button  type="info" size="large" url="/picture/index.html">看看有什么素材</van-button></div>
        </#if>
    </div>
    <van-pagination v-if="pageCount != 0"  v-model="currentPage" :page-count="pageCount" mode="simple"  class="mb-12 pd-12" @change="pageChange"></van-pagination>
</#assign>
<#assign pageScript>
    <script>
        var pageCount = ${totalPages}
        var currentPage = ${page.currentPage}
            new Vue({
                el: '#app',
                data() {
                    return {
                        showFooter: false,
                        pageCount : pageCount,
                        currentPage: currentPage
                    }
                },
                methods: {
                    pageChange(value) {
                        window.location.href = '/user/download/list.html?page=' + value;
                    },
                    toView(typeId,infoId){
                        var url = "/picture/view/"+infoId+".html";
                        if(typeId == 2){
                            url = "/course/view/"+infoId+".html";
                        }
                        window.location.href = url;
                    }
                }
            })
    </script>
</#assign>
<#include "../layout_h5.ftl" />